
import 'package:cunyutech_flutter_ui/src/theme/main.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart';

class AddImageButton extends StatelessWidget {

  const AddImageButton({
    Key key, 
    this.width = 86,
    this.crossWidth = 40,
    this.crossThickness = 2,
    this.borderThickness = 2,
    this.onTap,
  }) : super(key: key);

  final double width;
  final double crossWidth;
  final double crossThickness;
  final double borderThickness;
  final VoidCallback onTap;

  buildCross(BuildContext context) {
    var cs = CYThemeData.of(context);
    return Stack(
      alignment: Alignment.center,
      children: <Widget>[
        Container(
          height: crossThickness,
          width: crossWidth,
          decoration: BoxDecoration(
            color: cs.foreColorSystem.placeholderColor
          ),
        ),
        Container(
          width: crossThickness,
          height: crossWidth,
          decoration: BoxDecoration(
            color: cs.foreColorSystem.placeholderColor
          ),
        )
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    var cs = CYThemeData.of(context);
    return InkWell(
      onTap: onTap,
      child: Container(
        width: width,
        height: width,
        alignment: Alignment.center,
        child: DottedBorder(
          padding: EdgeInsets.all(0),
          color: cs.linkColor,
          child:  Container(
            child: buildCross(context),
            width: width,
            height: width,
          )
        ),
      ),
    );
  }
}